# -*- coding: utf-8 -*-
import argparse
import sys

class BaseCommand(object):
    def __init__(self):
        self.description = ''
        self.parser = None

    def create_parser(self,description):
        self.parser = argparse.ArgumentParser(description=description)
        self.add_argument(self.parser)

    def add_argument(self, parser):
        pass

    def execute(self, args):
        self.create_parser(self.description)
        if args is None:
            args = sys.argv[2:]
        self.run(self.parser.parse_args(args))

    def run(self, args):
        raise NotImplemented
